package BC69_空心正方形图案;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int num = sc.nextInt();

            for (int i = 0;i < num; i++){
                for (int j = 0; j < num; j++){
                    if (i == 0 || j == 0 || i == num - 1 || j == num - 1){
                        System.out.printf("* ");
                    }else {
                        System.out.printf("  ");
                    }

                }
                System.out.println();
            }


        }

    }
}
